import java.util.Arrays;
import java.util.Comparator;

public class Test01 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9,10};
        System.out.println(Arrays.toString(arr));
        System.out.println("----------");
        System.out.println(Arrays.binarySearch(arr,10));
        System.out.println(Arrays.binarySearch(arr,2));
        System.out.println(Arrays.binarySearch(arr,11));
        System.out.println("---------");
        /*int[] newArr1=Arrays.copyOf(arr,10);
        System.out.println(Arrays.toString(newArr1));*/
        int[] newArr1=Arrays.copyOf(arr,20);
        System.out.println(Arrays.toString(newArr1));
        /*int[] newArr2=Arrays.copyOfRange(arr,0,9);
        System.out.println(Arrays.toString(newArr2));
        */
        int[] newArr2=Arrays.copyOfRange(arr,0,19);
        System.out.println(Arrays.toString(newArr2));
        Arrays.fill(newArr1,100);
        System.out.println(Arrays.toString(newArr1));
        int[] arr2={10,2,3,5,6,11,7,8,4,9};
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
        Integer[] arr3={4,2,3,6,1,9,7,8,5};
        Arrays.sort(arr3,new Comparator<Integer>(){
            @Override
            public int compare(Integer o1,Integer o2){
                return o2-o1;
            }
        });
        System.out.println(Arrays.toString(arr3));
        Integer[] arr4={2,3,1,5,6,7,8,4,9};
        Arrays.sort(arr4,( o1, o2)->o1-o2);
        System.out.println(Arrays.toString(arr4));
        String[] arr5={"a","aaa","aaaa","aa"};
        Arrays.sort(arr5,( o1, o2)-> o1.length()-o2.length());
        System.out.println(Arrays.toString(arr5));
        String[] newArr3=Arrays.copyOf(arr5,7);
        System.out.println(Arrays.toString(newArr3));




    }
}
